package 力扣日常刷题.木23一月.第07天307;

import java.util.Arrays;

/**
 * @author 帅小伙
 * @date 2022/3/7
 * @description
 */
public class Demo13把数组排成最小的数 {

    public String minNumber(int[] nums) {
        String[] strings = new String[nums.length];

        for (int i = 0; i < nums.length; i++) {
            strings[i] = nums[i]+"";
        }
        Arrays.sort(strings,(a,b)->(a+b).compareTo(b+a));
        StringBuffer sb = new StringBuffer();
        for (String string : strings) {
            sb.append(string);
        }
        return sb.toString();
    }
}
